package com.gitee.mapper;

import com.gitee.entity.FollowList;
import org.apache.ibatis.annotations.*;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

@Mapper
public interface FollowListMapper {
    @Insert("insert into sxq_follow_list values(null,#{userId},#{followId},#{avatar},#{nickname})")
    void insert(FollowList followList);

    @Select("select count(*) from sxq_follow_list where user_id = #{userId}")
    Long count(Integer userId);

    @Select("select * from sxq_follow_list where follow_id = #{followId} and user_id = #{userId}")
    FollowList selectByFollowIdAndUserId(@Param("followId") Integer followId, @Param("userId") Integer userId);

    @Select("select * from sxq_follow_list where user_id = #{userId}")
    List<FollowList> selectByUserId(Integer userId);

    @Delete("delete from sxq_follow_list where user_id = #{userId} and follow_id = #{followId}")
    void deleteByUserIdAndFollowId(@Param("userId") Integer userId, @Param("followId") Integer followId);
}
